
f = open('C:/_DATA/format.prm','r')
#f = open('1.prm','r')
line = f.readline()

a = ""
while line:
    a += line
    line = f.readline()
f.close()


output_1 = a[:38]
#'+CASE'
output_2 = a[75:118]
pop_file = "C:/_DATA/CancerData/SatScan/own/old/temp_6000/satscan/three16.pop"
output_3 = a[118:162]
coor_file = "C:/_DATA/CancerData/SatScan/own/old/temp_6000/satscan/three16.geo"
output_4 = a[162:1086]
# '+ high(1) or low(2)'
output_5 = a[1086:1305]
# '+resultfile'
output_6 = a[1305:]


print '========================'

for i in range(0, 1000):
    case_file = "C:/_DATA/CancerData/SatScan/own/old/temp_6000/satscan/"+str(i)+".cas"
    result_file = "C:/_DATA/CancerData/SatScan/own/old/temp_6000/satscan/" + str(i)
    highlow = '1' # high(1) or low(2) or both(3)
    output = output_1 + case_file + output_2 + pop_file + output_3 + coor_file + output_4 + highlow + output_5+ result_file + output_6
    filename = 'C:/_DATA/CancerData/SatScan/own/old/temp_6000/satscan/' + str(i) + '.prm'
    f = open(filename,'w')
    f.write(output)
    f.close()

#print output
print "Done!"
